package org.xdq.lamdba;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;

public class Test2 {

    static class A{

        static List<A> list = new ArrayList<>();

        int n;

        A(int n){
           this.n = n;
           list.add(this);
        }

        @Override
        public String toString() {
            return "A{" +
                    "n=" + n +
                    '}';
        }
    }

    static interface My{
        public void f(int n);
    }

    public static void main(String[] args) {
//
//        My my = (int k)->{
//            new A(k);
//        };
//

        My my = A::new;

        my.f(3);
        my.f(5);
        my.f(8);

        System.out.println(A.list);

        A.list.forEach(System.out::println);
    }
}
